pub fn goldbach_conjecture() -> u64 {
    let mut prime_number_vec: Vec<u64> = Vec::new();
    let mut now_number:u64 = 2;
    let mut result_count = 0;
    let mut result:u64 = 0;
    while result_count != 2 {
        let is_prime = is_prime_number(now_number);
        if is_prime {
            // 素数列表
            prime_number_vec.push(now_number);
        }else if now_number % 2 != 0 {
            // 奇合数
            if !is_gdbh(now_number, &prime_number_vec){
                result_count += 1;
                result += now_number;
            }
        }
        now_number += 1;
    }
    
    return result;
}

pub fn is_prime_number(number: u64) -> bool {
    if number % 2 == 0 {
        return false;
    }else if number == 3 {
        return true;
    }else {
        let end = ((number as f64).sqrt() as u64) + 1;
        for i in 2..end {
            if number % i == 0 {
                return false;
            }
        }
    }
    return true;
}

pub fn is_gdbh(number: u64, prime_number_vec: &Vec<u64>) -> bool{
    for prime_number in prime_number_vec{
        let diff = number - prime_number;
        let is_sqrt = is_sqrt(diff/2);
        if is_sqrt {
            return true;
        }
    }
    return false;
}

// 是否是平分数
pub fn is_sqrt(number: u64) -> bool{
    let sqrt: u64 = (number as f64).sqrt() as u64;
    return sqrt*sqrt == number;
}